<?php

include "connect.php";

//Gets the product selected from the saddle shop page
$productID = $_POST['productID'];

$productDetails = mysql_query("SELECT * FROM products WHERE productID = $productID ");

 while($row = mysql_fetch_array($productDetails))
  {
	
   $productName = $row['productName'];
   $productCost = $row['productCost'];
   $saddleOnTrial = $row['onTrial'];
   $productDescription = $row['productDescription'];
   $keywords = $row['keywords'];
	  
  }

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title><?php echo "#".$productID." | ".$productName." - Details" ?></title>

<meta name="description" content="Buy horse saddles online with our large range of saddles for most disciplines including General Purpose | Dressage | Eventing | Working | Hunter and VSD. Buy or sell saddles online." />

<link href="css/productDetails.css" rel="stylesheet" type="text/css" />
<link href="css/main.css" rel="stylesheet" type="text/css" />

<style type="text/css">
body {
	background-image: url(images/background.jpg);
	background-repeat: repeat-x;
	background-position: center top;
	background-attachment: fixed;
	margin: 0px;
	padding: 0px;
}
</style>
<script type="text/javascript">
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
</script>

</head>

<body>



<?php include "header.php"; ?>

<?php
if ($specialOfferDetails != "")
{
echo '<marquee direction="left" dropzone="5">'.$specialOfferDetails.'</marquee>';
}
else
{
echo '<marquee direction="left" dropzone="5">WE BUY SADDLES Please send a clear photo (Up to a maximum of 3) along with the saddles Size, Width & Price to sales@24-7saddles.com</marquee>';
}
?>

<div id="content">

<div id="imageContainer">

<?php
//If the saddle is on trial then echo the saddle on trial banner
if($saddleOnTrial == "Yes")
{
echo '<h3 id="onTrial">Saddle On Trial</h3>';
}

?>

<!--Large Image-->
<?php
//Display the first product image
$image1ID = $productID."_1";

echo '<img src="http://www.24-7saddles.com/images/saddles/'.$image1ID.'.jpg" width="500" height="438" />';

?>



<div id="productDescription">

<!--Product Name-->
<h3><?php echo $productName ?></h3>

<p class="productDescriptionText"><?php echo $productDescription ?></p>

<span class="price"><i>Only </i><?php echo "£".$productCost; ?> <b>Product ID: <?php echo $productID ?></b></span>

<div id="smallImageContainer">

<div id="viewLargerImage">Click To View Larger Image </div>

 <?php
include "checkImages.php"; 
 
if ($file2Exists == "True")
{
echo '<a href="http://www.24-7saddles.com/images/saddles/'.$productID.'_2.jpg" onclick="window.open (this.href, "child", "height=600,width=800"); return false"><img alt="'.$productName.'" src="http://www.24-7saddles.com/images/saddles/'.$productID.'_2.jpg"></a>';	
}
 
if ($file3Exists == "True")
{
echo '<a href="http://www.24-7saddles.com/images/saddles/'.$productID.'_3.jpg" onclick="window.open (this.href, "child", "height=600,width=800"); return false"><img alt="'.$productName.'" src="http://www.24-7saddles.com/images/saddles/'.$productID.'_3.jpg"></a>';	
} 
 
if ($file4Exists == "True")
{
echo '<a href="http://www.24-7saddles.com/images/saddles/'.$productID.'_4.jpg" onclick="window.open (this.href, "child", "height=600,width=800"); return false"><img alt="'.$productName.'" src="http://www.24-7saddles.com/images/saddles/'.$productID.'_4.jpg"></a>';	
}
?> 




</div>
<!--Small Image Container #End-->

</div>
<!--Image Container #End-->

</div>
<!--Product Description #End-->


</div>
<!--Content #End-->

<div id="purchaseOptions">
<?php
//If saddle isnt on trial then link to = PayPal
if($saddleOnTrial=="Yes"){$linkTo = "yourDetails.php";} else {$linkTo="https://www.paypal.com/uk/cgi-bin/webscr";}

//Paypal Charges
$paypalInterest = 3;
$paypalCost = $productCost + (($productCost/100*$paypalInterest)+0.20);

?>
<form name="_xclick" action="<?php echo $linkTo ?>" method="post" id="buyPaypal">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="sales@24-7saddles.com">
<input type="hidden" name="currency_code" value="GBP">
<input type="hidden" name="item_name" value="<?php echo $productName ?>">
<input type="hidden" name="amount" value="<?php echo $paypalCost ?>">
<input type="hidden" name="productID" value="<?php echo $productID ?>">
<input type="hidden" name="item_number" value="<?php echo $productID ?>">
<input type="hidden" name="productName" value="<?php echo $productName ?>">
<input type="hidden" name="productCost" value="<?php echo $productCost ?>">

<select id="shippingDropdown" name="shipping">
 <option value="13">Delivery £13.00</option>
  <option value="0">Collection £0.00</option>
</select>

<?php
//Print Paypal Button if saddle isnt on trial
if($saddleOnTrial!="Yes")
{echo '<input type="submit" class="buyButton" value="Buy Through Paypal (£'.$paypalCost.')"  />';}
else
{echo '<input type="button" class="buyButton" value="On Trial Please Call 07908471905 To Backorder This Saddle"  />';}
?>
</form>

<form action="buyCash.php" method="post" name="buyCash">
<input type="hidden" name="productID" value="<?php echo $productID ?>" />
<input type="hidden" name="productName" value="<?php echo $productName ?>" />
<input type="hidden" name="productCost" value="<?php echo $productCost ?>" />

<?php
//Print Cash Button if saddle isnt on trial
if($saddleOnTrial!="Yes")
{echo '<input type="submit" class="buyButton" value="Buy Cash / Bank Transfer (£'.$productCost.')"  />';}
else
{}
?>

</form>




</div>
<!--Purchase Options #End-->
</div>
<!--Content #End-->

<?php include"footer.php" ?>


</body>
</html>